#include "GameEntity.h"


#include "../infLib/infLib.h"
#include "../sys/Sys_public.h"
#include "../framework/FileSystem.h"
#include "../framework/DeclManager.h"
#include "../framework/Common.h"
#include "../framework/CVarSystem.h"
#include "../framework/CmdSystem.h"
#include "../renderer/RenderSystem.h"
#include "../renderer/RenderWorld.h"
#include "../renderer/RenderModel.h"
#include "../bullet/Glue/PHYSystem.h"
#include "../infLib/math/Vector.h"
#include "../infLib/math/Quat.h"
#include "LinearMath/btVector3.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
GameEntity::GameEntity(renderEntity_t * prenderEntity_t)
	:m_renderEntity_t(prenderEntity_t)
{

}


GameEntity::~GameEntity(void)
{
	
}

void GameEntity::updata(float t)
{
  btVector3 pos =   m_pbtRigidBody->getWorldTransform().getOrigin();
  m_renderEntity_t->position.x = pos.m_floats[0];
  m_renderEntity_t->position.y = pos.m_floats[1];
  m_renderEntity_t->position.z = pos.m_floats[2];
}

bool GameEntity::initPhy()
{
	m_pbtRigidBody = phySystem->AddStaticMesh(m_renderEntity_t->model->GetSurface(0)->geometry, inf::Vec3::ZERO, inf::Vec3::ZERO ,inf::Quat::ONE, 1);
	return true;
}